<template>
    <div class="report-two">
        <div class="body">
            <div class="list">
                <h4>
                    <span>02</span>成绩整体情况
                </h4>
                <div class="paint">
                    <chart :options="option" :style="{width:'100%'}"></chart>
                    <div class="legend">
                        <div class="all">
                            全体
                            <img src="../../assets/img/report/all.png" alt="">
                        </div>
                        <div class="part">
                            校区
                            <img src="../../assets/img/report/part.png" alt="">
                        </div>
                    </div>
                </div>
                <div class="suggest">
                    <h1>学习建议</h1>
                    <p>
                        {{showText||''}}
                    </p>
                </div>
             </div>
        </div>

    </div>
</template>
<script>

import io from '../../lib/io'
import util from '../../lib/util'
export default {
    components: {

    },
    data() {
        return {
            reportId :"",
            showText:'',
            studentName:"",
            option: {
                devicePixelRatio:2,
                title: {
                    text: '人数分数分布图',
                    right:'50%',
                    textStyle:{
                        color:'#333',
                        fontSize:16,
                    }
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    axisLabel:{
                        color:'#333',
                        fontSize:14
                    },
                    axisLine:{
                        lineStyle:{
                            color:'#cecdcd'
                        }
                    },
                    axisTick:{
                        inside:true
                    },
                    splitLine:{
                        show:true,
                        lineStyle:{
                            color:'#ecebeb'
                        }
                    },
                    data: []
                },
                yAxis: {
                    type: 'value',
                    axisLabel:{
                        color:'#333',
                        fontSize:14
                    },
                    axisLine:{
                        lineStyle:{
                            color:'#cecdcd'
                        }
                    },
                    axisTick:{
                        inside:true
                    },
                    splitLine:{
                        show:true,
                        lineStyle:{
                            color:'#ecebeb'
                        }
                    },
                },
                series: [
                    {
                        name: '全体',
                        type: 'line',
                        lineStyle:{color:'#FF3F21'},
                        symbol:'none',
                        data: []
                    },
                    {
                        name: '校区',
                        type: 'line',
                        lineStyle:{color:'#19819F',type:'dashed'},
                        symbol:'none',
                        data: []
                    }
                ]
            },

        }
    },
    created(){
        this.reportId = this.$route.query.reportId
        this.studentName = decodeURI(this.$route.query.studentName)
  
    },
    mounted(){
        this.$nextTick(()=>{
            this.reportScore()
        })
    },
    methods:{
        reportScore(){
            let param = {
                reportId:this.reportId,
            }
            io.post(io.reportScore,param,(ret)=>{
                this.showText=ret.comment
                let xleng = ret.xAxis
                xleng.unshift('')
                this.option.xAxis.data = xleng //横坐标
                let series = ret.series
                series.map((item)=>{
                    var data = item.data
                    data.unshift('')
                    if(item.name=='全体'){
                        this.option.series[0].data = data
                    }else if(item.name == '校区'){
                        this.option.series[1].data = data
                    }
                })
            })
        }
    },

}
</script>
<style lang="less" scoped>
.report-two {
    height: 100%;
    background: rgba(251, 250, 250, 0.9);

}
.body{
    padding:46px 0;
    // background:#fff;
    .list{
        width:80%;
        max-width:960px;
        margin:0 auto;
        h4{
            font-size:32px;
            color:#ff7853;
            margin:0;
            height:32px;
            line-height:32px;
            font-weight: 100;
            span{
                height: 32px;
                line-height: 32px;
                font-weight: 100;
                // display: inline-block;
                float:left;
                font-size:40px;
                color:#488eed;
                padding-right:24px;
                margin-right:17px;
                border-right:2px solid #488eed;
            }
        }
        .paint{
            position:relative;
            margin-top:34px;
            .legend{
                position: absolute;
                top:20px;
                right:10%;
                display: flex;
                align-items: center;
                justify-content: center;
                font-size: 14px;
                color: #666;
                img{
                    margin-left: 10px;
                }
                .all{
                    margin-right: 35px;
                    // margin-left:35px;
                }
            }
        }
    }
}
.suggest{
    box-sizing: border-box;
    // margin-top: 30px;
    h1{
        font-size: 18px;
        height:18px;
        font-weight: 100;
        line-height: 18px;
        color: #488eed;
        margin-bottom: 22px;
    }
    p{
        font-size: 16px;
        color: #666;
        line-height: 24px;
    }
}

</style>
